package com.ywl.designpattern.state;

// 无硬币状态
public class NoCoinState implements State {
    VendingMachine vendingMachine;

    public NoCoinState(VendingMachine vendingMachine) {
        this.vendingMachine = vendingMachine;
    }

    @Override
    public void insertCoin() {
        System.out.println("硬币已插入");
        vendingMachine.setState(vendingMachine.getHasCoinState());
    }

    @Override
    public void ejectCoin() {
        System.out.println("您还没有插入硬币");
    }

    @Override
    public void selectItem() {
        System.out.println("请先插入硬币");
    }

    @Override
    public void dispense() {
        System.out.println("请先插入硬币");
    }
}
